<%--
  Created by IntelliJ IDEA.
  filename:master.jsp
    员工管理jsp
  User: 王威
  Date: 2021/12/2
  Time: 12:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>人员管理</title>
    <style>
        #center{
            margin: 0px auto;
            width: 830px;
            font-size: 25px;
        }
        table td{
            width: 200px;
            text-align: center;
            height: 80px
        ;
        }
        #tab a{
            cursor: pointer;
        }
        /*#tab a:hover{*/
        /*    color: #0A93CC;*/
        /*}*/
        .hover>a:nth-of-type(1):hover{
            color: red;
        }
        .hover>a:nth-of-type(2):hover{
            color: #0A93CC;
        }
    </style>
    <script src="/js/jquery-3.6.0.min.js"></script>
    <script>
        $(function(){
            init();
        })
        function init(){
            getAll();

        }
        function getAll() {
            $.ajax({
                "type":"post",
                "url":"/usercontrol.do",
                "data":{"opr":"selectAll"},
                "dataType":"json",
                "success":function(data){
                    $(data.data).each(function (i,o) {
                        $("#tab").append("<tr><td>"+o.eid+"</td><td>"+o.ename+"</td><td>"+o.sex+"</td>" +
                            "<td>"+o.role.roleName+"</td><td>"+o.access.rootName+"</td><td>"+(o.state)+"</td><td class='hover'>" +
                            "<a onclick='delUser()'>删除</a>&nbsp;&nbsp;<a >修改</a></td></tr>")
                    })
                    $("tr:even").css("background-color","#CCE8EB");
                }
            });
        }
        /*删除用户*/
        function delUser() {
            alert(123)
        }
    </script>
</head>
<body>
<div style="border: 1px solid black;width: 100%;height: 680px" >
    <div id="center">
        <table id="tab" border="4">
            <tr style="height: 50px;font-weight: bold">
                <td>员工编号</td>
                <td>员工姓名</td>
                <td>性别</td>
                <td>员工角色</td>
                <td>权限</td>
                <td>状态</td>
                <td>操作</td>
            </tr>
        </table>
    </div>
</div>
</body>
</html>
